#include <stdio.h>
#include <sys/time.h>

long long int fib(int n){
	if( n == 0 ) return 0;
	if( n == 1 ) return 1;
	return fib(n-1) + fib(n-2);
}

int main(int argc, char* argv[]){
	FILE* input;
	input = fopen(argv[1], "w");
	struct timeval counter;
	gettimeofday(&counter, NULL);
	double start = counter.tv_sec + (counter.tv_usec/1000000.0);
	int i = 0;
	for(i = 0;i < 50;i++){
		fprintf(input, "fib(%d) = %d\n", i, fib(i));
		fprintf(stdout,"fib(%d) = %d\n", i, fib(i));
		gettimeofday(&counter, NULL);
		fprintf(input, "time : %lf\n", counter.tv_sec + (counter.tv_usec/1000000.0) - start);
		fprintf(stdout, "time : %lf\n", counter.tv_sec + (counter.tv_usec/1000000.0) - start);
	}
	return 0;

}
